package com.tianpengtech.common.model.fairorder;

import com.tianpengtech.common.model.AbstractBaseModel;

/**
 * 实体类名-订单表 fair_order
 *
 * @since Fri Dec 01 16:55:13 HKT 2017
 */
public class FairOrder extends AbstractBaseModel<FairOrder> {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	public static final FairOrder dao = new FairOrder();

	public static final String ID = "id"; //
	public static final String XML_CONTENT = "xml_content"; // 微信返回xml内容
	public static final String OBJ_ID = "obj_id"; // 支付物品id
	public static final String ORDER_NO = "order_no"; // 订单号
	public static final String USER = "user"; // 支付人
	public static final String STATUS = "status"; // 订单状态
	public static final String OPT_TYPE = "opt_type"; // 操作类型
	public static final String PAY_URL = "pay_url"; // 支付连接
	public static final String CREATE_TIME = "create_time"; // 创建时间
	public static final String SIGN = "sign"; // 订单签名信息
	public static final String PREPAY_ID = "prepay_id"; // 预付订单ID
	public static final String TRADE_TYPE = "trade_type"; // 支付类型
	public static final String TOTAL_FEE = "total_fee"; // 订单价格
	public static final String ORDER_DESC = "order_desc"; // 订单描述
	public static final String UNIQUE_ID = "unique_id"; // 订单描述

	
	public static final int STATUS_STANDBY=0;//等待支付
	public static final int STATUS_PAYED=1;//已支付
	public static final int STATUS_CANCEL=2;//已取消
	
	public static final int OPT_TYPE_CHARGE=0;//任务充值
	public static final int OPT_TYPE_TASK=1;//任务充值
	public static final int OPT_TYPE_TASK_SALARY=3;//余额支付任务金
	
	public static final String NATIVE="NATIVE";
	public static final String USER_SALARY="USER_SALARY";
	
	public String status(){
		String result="未知";
		if(getInt(STATUS)==STATUS_STANDBY){
			result="待支付";
		}else if(getInt(STATUS)==STATUS_PAYED){
			result="已支付";
		}else if(getInt(STATUS)==STATUS_CANCEL){
			result="已取消";
		}
		return result;
	}
	
	
	public String opt_type(){
		String result="未知";
		if(getInt(OPT_TYPE)==OPT_TYPE_CHARGE){
			result="账户充值操作";
		}else if(getInt(OPT_TYPE)==OPT_TYPE_TASK){
			result="发布任务充值";
		}else if(getInt(OPT_TYPE)==OPT_TYPE_TASK_SALARY){
			result="发布任务余额充值";
		}
		return result;
	}
	
	public String trade_type(){
		String result="未知";
		if(getStr(TRADE_TYPE).equals(NATIVE)){
			result="微信扫码支付";
		}else if(getStr(TRADE_TYPE).equals(USER_SALARY)){
			result="余额支付";
		}
		return result;
	}
	
	
	
	
	public String total_fee(){
		double v= getDouble(TOTAL_FEE);
		if(v==0){
			return "￥0";
		}
		return "￥"+(v/100);
	}
	
	@Override
	public String tableName() {
		return "fair_order";
	}

}